package com.steven.nio;

import java.nio.IntBuffer;

public class BasicBuffer {

    public static void main(String[] args) {
        //buffer简单说明
        //存放5个int类型
        IntBuffer allocate = IntBuffer.allocate(5);
        allocate.put(10);
        allocate.put(11);
        allocate.put(12);
        allocate.put(13);
        allocate.put(14);
        //buffer取数据
        //读写切换
        allocate.flip();
        while (allocate.hasRemaining()){
            System.out.println(allocate.get());
        }
    }

}
